{% load i18n %}
<link rel="shortcut icon" href="/static/favicon.ico" />
<link rel="bookmark" href="/static/favicon.ico" type="image/x-icon"　/>
<link href="/static/favicon.ico" mce_href="/static/favicon.ico" rel="icon" type="image/x-icon">
<link rel="apple-touch-icon" href="/static/apple-touch-icon.png">

<script src="/static/lib/csrf.js"></script>
<script>
        $(document).ready(function() {
            $(".new-top-fix").addClass("").removeClass("nav-default");
            $(".new-top-fix").addClass("header-positsion");
            $(".footer").addClass("footer-bg");
            $('.lang').hover(
                function(){$('.lanague').addClass('selected');},
                function () {$('.lanague').removeClass('selected');}
            );
        })

        function set_lang(code){
            var str = $("#form_lang").serialize()
            str += '&language='+code
            $.post("{%url 'set_language'%}", str, function(data){
                window.location.reload()
            });
        }

$(document).ajaxSend(function(event, xhr, settings) { 
    function getCookie(name) { 
        var cookieValue = null; 
        if (document.cookie && document.cookie != '') { 
            var cookies = document.cookie.split(';'); 
            for (var i = 0; i < cookies.length; i++) { 
            var cookie = jQuery.trim(cookies[i]); 
            // Does this cookie string begin with the name we want 
            if (cookie.substring(0, name.length + 1) == (name + '=')) { 
                cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); 
                break; 
            } 
        } 
    } 
    return cookieValue; 
} 
function sameOrigin(url) { 
    // url could be relative or scheme relative or absolute 
    var host = document.location.host; // host + port 
    var protocol = document.location.protocol; 
    var sr_origin = '//' + host; 
    var origin = protocol + sr_origin; 
    // Allow absolute or scheme relative URLs to same origin 
    return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || 
    (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || 
    // or any other URL that isn't scheme relative or absolute i.e relative. 
    !(/^(\/\/|http:|https:).*/.test(url)); 
} 
function safeMethod(method) { 
    return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); 
} 
if (!safeMethod(settings.type) && sameOrigin(settings.url)) { 
    xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); 
} 
});
</script>

<!-- 头部导航条 -->
<div class="nav_top">
    <nav class="nav">
        <div class="navCente">
            <div class="nav-img"><a href="{%url 'index'%}"><img  src="/static/home_page/img/logo.png" alt=""></a></div>
            <div class="nav-title">
                <ul>
                    <a  href="{%url 'index'%}"><li id="nav_index" >{%trans '首页'%}</li></a>
                    <a href="{%url 'trade'%}"><li id="nav_trade" >{%trans '交易中心'%}</li></a>
                    <a href="{%url 'c2c'%}"><li id="nav_c2c">{%trans '充值提现'%}</li></a>
                    <a href="{%url 'userinfo_balances'%}"><li id="nav_balance">{%trans '资金中心'%}</li></a>
                    <!--
                    <a target="_blank" href="http://13560002011.udesk.cn/hc/articles/58903"><li>{% trans '公告' %}</li id="nav_trade"></a>
                    -->
                    <a href="http://support.niubiex.com/hc/zh-cn"><li>{% trans '公告' %}</li id="nav_trade"></a>
                </ul>
            </div>
            <div class="nav-hug">
                {% if user.is_authenticated %}
                <ul class="nav-loginTwo">
                    <li><a href="{%url 'userinfo' %}">{{user.phone}}</a></li> &nbsp;
                    <li><a href="/users/logout/?next={%url 'trade'%}">{% trans '注销' %}</a></li>
                </ul>
                {% else %}
                <ul class="nav-login">
                    <li><a href="/users/login?next=/{%url 'trade'%}">{% trans '登录' %}</a></li>
                    <li><a href="/users/register?next=/{%url 'users:login'%}">{% trans '注册' %}</a></li>
                </ul>
                {% endif %}
            </div>
            <div class="codeHug">
                <div class="mobie"><a id="app_link" href="#">{% trans '手机APP' %}</a></div>
                <div class="code">
                    <img src="/static/home_page/img/er.png" alt="">
                </div>
            </div>
            <div class="lang">
                {% get_current_language as LANGUAGE_CODE %}
                {% get_current_language as LANGUAGE_CODE %}
                {% get_available_languages as LANGUAGES %}
                {% get_language_info_list for LANGUAGES as languages %}
                {% for language in languages %}
                {% if language.code == LANGUAGE_CODE %}
                <a href="javascript:" class="btn-lang">{{language.name_local}}<span class="comicon"></span></a>
                {% endif %}
                {% endfor %}
                <div class="cont">
                    <ul class="lang-list">
                        <li ><a href="javascript:" onclick="set_lang('zh-hans')">简体中文</a></li>
                        <li><a href="javascript:" onclick="set_lang('zh-hant')">繁體中文</a></li>
                        <li><a href="javascript:" onclick="set_lang('en')">English</a></li>
                        <li><a href="javascript:" onclick="set_lang('ja')">日本語</a></li>
                        <!--
                        <li><a href="javascript:" onclick="set_lang('de')">Deutsche</a></li>
                        <li><a href="javascript:;" onclick="set_lang('fr')">français</a></li>
                        -->
                        <li><a href="javascript:">{% trans '更多添加中' %}</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>
</div>
